package com.huan.controller;

import com.huan.domain.ResponseResult;
import com.huan.domain.entity.Menu;
import com.huan.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MenuController {
    @Autowired
    private MenuService menuService;
    @GetMapping("/system/menu/list")
    public ResponseResult mlist(String status,String menuName){
       return menuService.mlist(status,menuName);
    }
    @PostMapping("/system/menu")
    public ResponseResult add(@RequestBody Menu menu){
        return menuService.addList(menu);
    }
    @GetMapping("system/menu/{id}")
    public ResponseResult getMenu(@PathVariable Long id){
        return menuService.getMenu(id);
    }
    @PutMapping("/system/menu")
    public ResponseResult upd(@RequestBody Menu menu){
        return menuService.udMenu(menu);
    }
    @DeleteMapping("system/menu/{menuId}")
    public ResponseResult deleteMenu(@PathVariable Long menuId){
        return menuService.deleteMenu(menuId);
    }
    @GetMapping("/system/menu/treeselect")
    public ResponseResult treeselect(){
        return menuService.getTreeMenu();
    }
}
